package com.sskj.functions.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.MD5Util;
import com.sskj.functions.activity.FrashActivity;
import com.sskj.functions.presenter.BasePresenter;
import com.sskj.lib.bean.FrashDataBean;
import com.sskj.lib.http.JsonCallBack;

/**
 * @author Hey
 * Create at  2019/06/26
 */
public class FrashPresenter extends BasePresenter<FrashActivity> {

    public void getFrashData(String btc) {
        httpService.getFrashData(btc)
                .tag(this)
                .execute(new JsonCallBack<HttpData<FrashDataBean>>() {
                    @Override
                    public void onSuccess(Response<HttpData<FrashDataBean>> response) {
                        FrashDataBean data = response.body().getData();
                        mView.getFrashData(data);
                    }
                });
    }

    public void enSureExchange(String toString, String tv, String toString1) {
        httpService.onSureExchange(toString, MD5Util.getFiveMd5Value(tv),toString1)
                .tag(this)
                .execute(new JsonCallBack<HttpData>() {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.enSureExchangeSuccess();
                    }
                });
    }
}
